package db.pojo;

import java.util.*;
import java.text.SimpleDateFormat;
import db.ext.Order_infoExt;
@SuppressWarnings("unchecked")
/**
 * order_info
 */
public class Order_info {
	/**
	 * ORDERID
	 */
	public String oRDERID;
	/**
	 * PRODUCTID
	 */
	public String pRODUCTID;
	/**
	 * PRODUCTNAME
	 */
	public String pRODUCTNAME;
	/**
	 * COUNT
	 */
	public int cOUNT;
	/**
	 * TOTALPRICE
	 */
	public String tOTALPRICE;
	/**
	 * MEMBERID
	 */
	public String mEMBERID;
	/**
	 * MEMBERNAME
	 */
	public String mEMBERNAME;
	/**
	 * MEMBERIPHONE
	 */
	public String mEMBERIPHONE;
	/**
	 * REALPRICE
	 */
	public double rEALPRICE;
	/**
	 * ORDERTIME
	 */
	public String oRDERTIME;
	/**
	 * SOLDERID
	 */
	public String sOLDERID;
	/**
	 * SOLDTYPE
	 */
	public String sOLDTYPE;
	/**
	 * DISCOUNT
	 */
	public double dISCOUNT;
	/**
	 * STATUS
	 */
	public String sTATUS;
	/**
	 * OTHER
	 */
	public String oTHER;
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static Order_infoExt DB = new Order_infoExt(); 
	
	public Order_info() {
		super();
	}
	
	public Order_info(String oRDERID, String pRODUCTID, String pRODUCTNAME, int cOUNT, String tOTALPRICE, String mEMBERID, String mEMBERNAME, String mEMBERIPHONE, double rEALPRICE, String oRDERTIME, String sOLDERID, String sOLDTYPE, double dISCOUNT, String sTATUS, String oTHER) {
		super();
		this.oRDERID = oRDERID; 
		this.pRODUCTID = pRODUCTID; 
		this.pRODUCTNAME = pRODUCTNAME; 
		this.cOUNT = cOUNT; 
		this.tOTALPRICE = tOTALPRICE; 
		this.mEMBERID = mEMBERID; 
		this.mEMBERNAME = mEMBERNAME; 
		this.mEMBERIPHONE = mEMBERIPHONE; 
		this.rEALPRICE = rEALPRICE; 
		this.oRDERTIME = oRDERTIME; 
		this.sOLDERID = sOLDERID; 
		this.sOLDTYPE = sOLDTYPE; 
		this.dISCOUNT = dISCOUNT; 
		this.sTATUS = sTATUS; 
		this.oTHER = oTHER; 
	}
	
	public String getORDERID() {
		return oRDERID;
	}

	public void setORDERID(String oRDERID) {
		this.oRDERID = oRDERID;
	} 
	
	public String getPRODUCTID() {
		return pRODUCTID;
	}

	public void setPRODUCTID(String pRODUCTID) {
		this.pRODUCTID = pRODUCTID;
	} 
	
	public String getPRODUCTNAME() {
		return pRODUCTNAME;
	}

	public void setPRODUCTNAME(String pRODUCTNAME) {
		this.pRODUCTNAME = pRODUCTNAME;
	} 
	
	public int getCOUNT() {
		return cOUNT;
	}

	public void setCOUNT(int cOUNT) {
		this.cOUNT = cOUNT;
	} 
	
	public void changeCOUNTWith(int cOUNT){
		this.cOUNT += cOUNT;
	}
	
	public void changeCOUNTWithMin(int cOUNT,int min){
		this.cOUNT += cOUNT;
		this.cOUNT = this.cOUNT < min ? min : this.cOUNT;
	}
	
	public void changeCOUNTWithMax(int cOUNT,int max){
		this.cOUNT += cOUNT;
		this.cOUNT = this.cOUNT > max ? max : this.cOUNT;
	}
	
	public void changeCOUNTWithMaxMin(int cOUNT,int max,int min){
		this.cOUNT += cOUNT;
		this.cOUNT = this.cOUNT < min ? min : this.cOUNT;
		this.cOUNT = this.cOUNT > max ? max : this.cOUNT;
	}	
	public String getTOTALPRICE() {
		return tOTALPRICE;
	}

	public void setTOTALPRICE(String tOTALPRICE) {
		this.tOTALPRICE = tOTALPRICE;
	} 
	
	public String getMEMBERID() {
		return mEMBERID;
	}

	public void setMEMBERID(String mEMBERID) {
		this.mEMBERID = mEMBERID;
	} 
	
	public String getMEMBERNAME() {
		return mEMBERNAME;
	}

	public void setMEMBERNAME(String mEMBERNAME) {
		this.mEMBERNAME = mEMBERNAME;
	} 
	
	public String getMEMBERIPHONE() {
		return mEMBERIPHONE;
	}

	public void setMEMBERIPHONE(String mEMBERIPHONE) {
		this.mEMBERIPHONE = mEMBERIPHONE;
	} 
	
	public double getREALPRICE() {
		return rEALPRICE;
	}

	public void setREALPRICE(double rEALPRICE) {
		this.rEALPRICE = rEALPRICE;
	} 
	
	public void changeREALPRICEWith(double rEALPRICE){
		this.rEALPRICE += rEALPRICE;
	}
	
	public void changeREALPRICEWithMin(double rEALPRICE,double min){
		this.rEALPRICE += rEALPRICE;
		this.rEALPRICE = this.rEALPRICE < min ? min : this.rEALPRICE;
	}
	
	public void changeREALPRICEWithMax(double rEALPRICE,double max){
		this.rEALPRICE += rEALPRICE;
		this.rEALPRICE = this.rEALPRICE > max ? max : this.rEALPRICE;
	}
	
	public void changeREALPRICEWithMaxMin(double rEALPRICE,double max,double min){
		this.rEALPRICE += rEALPRICE;
		this.rEALPRICE = this.rEALPRICE < min ? min : this.rEALPRICE;
		this.rEALPRICE = this.rEALPRICE > max ? max : this.rEALPRICE;
	}	
	public String getORDERTIME() {
		return oRDERTIME;
	}

	public void setORDERTIME(String oRDERTIME) {
		this.oRDERTIME = oRDERTIME;
	} 
	
	public String getSOLDERID() {
		return sOLDERID;
	}

	public void setSOLDERID(String sOLDERID) {
		this.sOLDERID = sOLDERID;
	} 
	
	public String getSOLDTYPE() {
		return sOLDTYPE;
	}

	public void setSOLDTYPE(String sOLDTYPE) {
		this.sOLDTYPE = sOLDTYPE;
	} 
	
	public double getDISCOUNT() {
		return dISCOUNT;
	}

	public void setDISCOUNT(double dISCOUNT) {
		this.dISCOUNT = dISCOUNT;
	} 
	
	public void changeDISCOUNTWith(double dISCOUNT){
		this.dISCOUNT += dISCOUNT;
	}
	
	public void changeDISCOUNTWithMin(double dISCOUNT,double min){
		this.dISCOUNT += dISCOUNT;
		this.dISCOUNT = this.dISCOUNT < min ? min : this.dISCOUNT;
	}
	
	public void changeDISCOUNTWithMax(double dISCOUNT,double max){
		this.dISCOUNT += dISCOUNT;
		this.dISCOUNT = this.dISCOUNT > max ? max : this.dISCOUNT;
	}
	
	public void changeDISCOUNTWithMaxMin(double dISCOUNT,double max,double min){
		this.dISCOUNT += dISCOUNT;
		this.dISCOUNT = this.dISCOUNT < min ? min : this.dISCOUNT;
		this.dISCOUNT = this.dISCOUNT > max ? max : this.dISCOUNT;
	}	
	public String getSTATUS() {
		return sTATUS;
	}

	public void setSTATUS(String sTATUS) {
		this.sTATUS = sTATUS;
	} 
	
	public String getOTHER() {
		return oTHER;
	}

	public void setOTHER(String oTHER) {
		this.oTHER = oTHER;
	} 
	
	
	public Map order_infoToMap() {
		Map map = new HashMap();
		try {
			map.put("oRDERID",this.oRDERID);
			map.put("pRODUCTID",this.pRODUCTID);
			map.put("pRODUCTNAME",this.pRODUCTNAME);
			map.put("cOUNT",this.cOUNT);
			map.put("tOTALPRICE",this.tOTALPRICE);
			map.put("mEMBERID",this.mEMBERID);
			map.put("mEMBERNAME",this.mEMBERNAME);
			map.put("mEMBERIPHONE",this.mEMBERIPHONE);
			map.put("rEALPRICE",this.rEALPRICE);
			map.put("oRDERTIME",this.oRDERTIME);
			map.put("sOLDERID",this.sOLDERID);
			map.put("sOLDTYPE",this.sOLDTYPE);
			map.put("dISCOUNT",this.dISCOUNT);
			map.put("sTATUS",this.sTATUS);
			map.put("oTHER",this.oTHER);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

	public Order_info mapToOrder_info(Map map){
		try {
			String oRDERID =  map.get("oRDERID").toString();
			String pRODUCTID =  map.get("pRODUCTID").toString();
			String pRODUCTNAME =  map.get("pRODUCTNAME").toString();
			int cOUNT = Integer.parseInt( map.get("cOUNT").toString());
			String tOTALPRICE =  map.get("tOTALPRICE").toString();
			String mEMBERID =  map.get("mEMBERID").toString();
			String mEMBERNAME =  map.get("mEMBERNAME").toString();
			String mEMBERIPHONE =  map.get("mEMBERIPHONE").toString();
			double rEALPRICE = Double.parseDouble( map.get("rEALPRICE").toString());
			String oRDERTIME =  map.get("oRDERTIME").toString();
			String sOLDERID =  map.get("sOLDERID").toString();
			String sOLDTYPE =  map.get("sOLDTYPE").toString();
			double dISCOUNT = Double.parseDouble( map.get("dISCOUNT").toString());
			String sTATUS =  map.get("sTATUS").toString();
			String oTHER =  map.get("oTHER").toString();
			Order_info order_info = new Order_info(oRDERID, pRODUCTID, pRODUCTNAME, cOUNT, tOTALPRICE, mEMBERID, mEMBERNAME, mEMBERIPHONE, rEALPRICE, oRDERTIME, sOLDERID, sOLDTYPE, dISCOUNT, sTATUS, oTHER);
			return order_info;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	} 
	
	public String toString(){
		return order_infoToMap().toString();
	}
	
	//方便数据操作	
	public Order_info insert(){
		return DB.insert(this);
	}
	public Order_info update(){
		return DB.update(this);
	}
	
	public int delete(){
		return DB.delete(this);
	}
	
}
